<?php

namespace App\Modules\Admin\Http\Requests\Statistic;

use App\Modules\Admin\Http\Controllers\BaseController;
use App\Modules\Admin\Services\Water\CommunityService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;


class StatisticController  extends BaseController
{

    public function __construct(CommunityService $service)
    {
        $this->service = $service;
    }
    /**
     *统计
     * @Author: 纪永峰
     * @Email:   1053088021@qq.com
     * @param Request $request
     * @return JsonResponse
     */
    public function apparatus(Request $request): JsonResponse
    {
        if ($result = $this->service->apparatus($request->all())){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }
    }
    public function scores(Request $request): JsonResponse
    {
        if ($result = $this->service->scores($request->all())){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }
    }
    public function allScores(Request $request): JsonResponse
    {
        if ($result = $this->service->allScores($request->all())){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }
    }
    public function propertyFee(Request $request): JsonResponse
    {
        if ($result = $this->service->propertyFee($request->all())){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }
    }
}
